package main

import (
	"fmt"
	// "fmt"
	"github.com/pebbe/zmq4"
	"log"
	// "time"
)

func main() {
	log.SetFlags(log.Lshortfile)
	context, err := zmq4.NewContext()
	if err != nil {
		log.Println(err)
	}
	receiver, err := context.NewSocket(zmq4.PUSH)
	if err != nil {
		log.Println(err)
	}
	err = receiver.Connect("tcp://127.0.0.1:5557")
	if err != nil {
		log.Println(err)
	}

	sender, err := context.NewSocket(zmq4.PUSH)
	if err != nil {
		log.Println(err)
	}
	err = sender.Connect("tcp://127.0.0.1:5558")
	if err != nil {
		log.Println(err)
	}
	log.Println("wait")
	for {
		res, err := receiver.RecvMessage(zmq4.SNDMORE)
		if err != nil {
			log.Println(err)
		}
		log.Println(res)
	}
}
